-
Notifications
You must be signed in to change notification settings - Fork 899
Checkout update #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkout update #292
Conversation
string fullPath = Path.Combine(repo.Info.WorkingDirectory, fileFullPath); | ||
File.WriteAllText(fullPath, originalFileContent); | ||
repo.Index.Stage(fullPath); | ||
repo.Commit("change in master"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's recommended to add some Signature
s. Otherwise, LibGit2Sharp will try to infer the identity of the author/committer from the global config (which may not exist).
Changing this would make the Travis build pass, for instance 😉
@jamill I love it. The code is very clean! |
@nulltoken Thanks for the review! will update based on your feedback shortly |
File.WriteAllText(ignoredFilePath, "hello from this ignored file."); | ||
|
||
// The following check does not report ignored entries... | ||
// Assert.Equal(1, repo.Index.RetrieveStatus().Ignored.Count()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that Index.RetrieveStatus()
does not return Ignored entries? Is this expected? If so, what does the Ignored
property represent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatusFixture
has passing tests around ignored files, so it would surprise me that this assert fails but the following one passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm...
I've got the following test unexpectedly failing 😢. On it.
[Fact]
public void RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectivesThroughoutDirectories()
{
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoWorkingDirPath);
using (var repo = new Repository(path.RepositoryPath))
{
string ignoredDirectoryPath = Path.Combine(repo.Info.WorkingDirectory, "bin");
Directory.CreateDirectory(ignoredDirectoryPath);
string relativePath = Path.Combine("bin", "look-ma.txt");
string fullFilePath = Path.Combine(repo.Info.WorkingDirectory, relativePath);
File.WriteAllText(fullFilePath, "I'm going to be ignored!");
string gitignorePath = Path.Combine(repo.Info.WorkingDirectory, ".gitignore");
File.WriteAllText(gitignorePath, "bin");
RepositoryStatus newStatus = repo.Index.RetrieveStatus();
Assert.Equal(FileStatus.Ignored, repo.Index.RetrieveStatus(relativePath));
Assert.Equal(new[] { relativePath }, newStatus.Ignored);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nulltoken Yes, I think that is the same (unexpected) behavior I noticed.
Rebased and updated as per discussion. |
And merged! ✨ ✨ ✨ ✨ ✨ ✨ ✨ |
@nulltoken Thanks! |
This PR updates LibGit2Sharp in response to the recent checkout updates in libgit2. We now call
git_checkout_tree
and then update head so that checkout can take into account the current working directory, current head, and the target commit.This also re-enables a reset test which was temporarily disabled.